/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.farmcode.plugin.objectinfo.datasource;

import com.farmcode.plugin.objectinfo.datasource.types.ObjectInfoLocalDatasourceTables;
import com.farmcode.plugin.objectinfo.datasource.types.ObjectInfoLocalDatasourceViews;
import com.farmcode.api.plugin.ObjectInfoPlugin;
import com.farmcode.api.plugin.objectinfo.ObjectInfoPluginManager;
import com.farmcode.api.plugin.objectinfo.PluginManagerDescriptor;
import com.farmcode.api.plugin.objectinfo.PluginNotFoundException;

/**
 *
 * @author oscar
 */
public class DatasourceManagerPlugin extends PluginManagerDescriptor implements ObjectInfoPluginManager{

    public DatasourceManagerPlugin() {
        super("com/farmcode/plugin/objectinfo/datasource/descriptor.properties");
    }
    
    @Override
    public ObjectInfoPlugin getPlugin(String name) throws PluginNotFoundException{
        ObjectInfoPlugin objectInfoPlugin = null;
        if(name.equals("table")){
            objectInfoPlugin = new ObjectInfoLocalDatasourceTables();
        } else if(name.equals("view")) {
            objectInfoPlugin = new ObjectInfoLocalDatasourceViews();
        } else {
            throw new PluginNotFoundException();
        }
        return objectInfoPlugin;
    }
    
}
